package com.htgd.gardenexpo.service.impl;

import com.htgd.gardenexpo.entity.GeConParkPlanningUpload;
import com.htgd.gardenexpo.dao.GeConParkPlanningUploadDao;
import com.htgd.gardenexpo.service.GeConParkPlanningUploadService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * (GeConParkPlanningUpload)表服务实现类
 *
 * @author makejava
 * @since 2021-06-10 17:18:47
 */
@Service("geConParkPlanningUploadService")
public class GeConParkPlanningUploadServiceImpl implements GeConParkPlanningUploadService {
    @Resource
    private GeConParkPlanningUploadDao geConParkPlanningUploadDao;

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    @Override
    public GeConParkPlanningUpload queryById(Integer id) {
        return this.geConParkPlanningUploadDao.queryById(id);
    }

    /**
     * 查询多条数据
     *
     * @param offset 查询起始位置
     * @param limit  查询条数
     * @return 对象列表
     */
    @Override
    public List<GeConParkPlanningUpload> queryAllByLimit(int offset, int limit) {
        return this.geConParkPlanningUploadDao.queryAllByLimit(offset, limit);
    }

    @Override
    public List<GeConParkPlanningUpload> queryByPlanId(int id) {
        return this.geConParkPlanningUploadDao.queryByPlanId(id);
    }

    /**
     * 新增数据
     *
     * @param geConParkPlanningUpload 实例对象
     * @return 实例对象
     */
    @Override
    public GeConParkPlanningUpload insert(GeConParkPlanningUpload geConParkPlanningUpload) {
        this.geConParkPlanningUploadDao.insert(geConParkPlanningUpload);
        return geConParkPlanningUpload;
    }

    /**
     * 修改数据
     *
     * @param geConParkPlanningUpload 实例对象
     * @return 实例对象
     */
    @Override
    public GeConParkPlanningUpload update(GeConParkPlanningUpload geConParkPlanningUpload) {
        this.geConParkPlanningUploadDao.update(geConParkPlanningUpload);
        return this.queryById(geConParkPlanningUpload.getId());
    }

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Integer id) {
        return this.geConParkPlanningUploadDao.deleteById(id) > 0;
    }

    @Override
    public boolean deleteByPlanId(Integer id) {
        return this.geConParkPlanningUploadDao.deleteByPlanId(id) > 0;
    }

    @Override
    public boolean deleteByIds(String[] id,int pid) {
        return this.geConParkPlanningUploadDao.deleteByIds(id,pid) > 0;
    }
}
